package com.zzu.utils;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.zzu.view.activity.ExpressInfoAndMapActivity;
import com.zzu.view.fragment.ExpressInfoFragment;

/**
 * @description:
 * @author: bytedance
 * @date: 2021-05-10 02:17
 */
public class ChangeActivity {

    private static final String TAG = ChangeActivity.class.getName();
    public static final String PACKAGE_INFO = "packageInfo";
    public static final String ADDRESS = "address";

    public static void ChangeExpressInfo(Context context,String packageId){
        ChangeExpressInfo(context,packageId,"河南省郑州市中原区");
    }

    //跳转到viewpager的avtivity
    public static void ChangeExpressInfo(Context context,String packageId,String address){
        //跳转的时候传入packageId和address
        Intent intent = new Intent(context, ExpressInfoAndMapActivity.class);
        intent.putExtra(ExpressInfoFragment.NOW_ADDRESS,address);
        intent.putExtra(ExpressInfoFragment.PACKAGE_ID,packageId);
        Log.i(TAG,"传入的包裹信息"+packageId+","+address);
        context.startActivity(intent);
    }

    //跳转到之前的activity
//    public static void ChangeExpressInfo(Context context,String packageId,String address){
//
//        //加载进度条
//        ProgressDialog dialog = ProgressDialog.show(context, "提示", "正在加载中...");
//        //设置点击返回键取消对话框
//        dialog.setCancelable(true);
//        Log.i(TAG,"进行页面Activity的跳转");
//        //查询包裹的详细信息然后进行跳转
//        new PackagePresenterImpl(context,new PackageQueryView<PackageItem>() {
//
//            @Override
//            public void getDates(PackageItem data) {
//                if(data == null){
//                    Log.i(TAG,"没有获取到数据");
//                    return;
//                }
//                //设置包裹当前扫描的位置
//                data.setNowAddress(address);
//                Log.i(TAG,"包裹id为"+packageId+"信息为："+data.toString());
//                Intent intent = new Intent(context, ExpressInfoActivity.class);
//                intent.putExtra(PACKAGE_INFO,data);
//                dialog.dismiss();
//                context.startActivity(intent);
//            }
//
//            @Override
//            public void getNoDate() {
//                Log.i(TAG,"没有该订单信息");
//                dialog.dismiss();
//                Toast.makeText(context, "对不起，没有该订单信息！！", Toast.LENGTH_LONG).show();
//                return;
//            }
//        }).getPackageById(packageId);
//
//    }
}
